package com.huluobo.a2201mvvm_imdemo.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.a2201mvvm_imdemo.R;
import com.huluobo.a2201mvvm_imdemo.shop.GoodsBeanResult;

import java.util.List;

/**
 * Created by LC on 2024/4/8.
 */
public class ShopAdapter extends BaseQuickAdapter<GoodsBeanResult.GoodsBean, BaseViewHolder> {
    public ShopAdapter(@Nullable List<GoodsBeanResult.GoodsBean> data) {
        super(R.layout.item_shop, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GoodsBeanResult.GoodsBean goodsBean) {
        Glide.with(getContext()).load(goodsBean.getGoods_default_icon()).into((ImageView) baseViewHolder.getView(R.id.item_shop_iv));
        baseViewHolder.setText(R.id.item_shop_desc_tv, goodsBean.getGoods_desc());
        baseViewHolder.setText(R.id.item_shop_price_tv, goodsBean.getGoods_default_price() + "元");
    }
}
